<?php
$this->render('include/sortLink.phtml');
echo $this->render('system/session/_tab.phtml');
$this->headScript()->appendFile(_STATIC_HTTP . '/jquery/checkAll.js');
if(!function_exists('__sortLink')) {
	function __sortLink() {}
}
?>
<form action="" method="post">
<div class="body">
	<table class="list">
		<tr>
			<th class="id sort"><?php echo __sortLink('sid', 'SID');?></th>
			<th class="sort"><?php echo __sortLink('host', 'VISIT');?></th>
			<th class="time sort"><?php echo __sortLink('date', 'TIME');?></th>
			<th class="narrow center"><?php echo '<input type="checkbox" name="select-all" id="select-all" value="1" rel="sid[]" />';?></th>
		</tr>
		<?php
		foreach($this->list AS $row) {
			$url = 'http://' . $row->getHost() . urldecode($row->getRequestUri());
			$ref = '';
			if($row->getReferer()) {
				$ref = '<a href="' . urldecode($row->getReferer()) . '" target="_blank" style="text-decoration:none;">' . urldecode($row->getReferer()) . '</a>';
			}
		?>
		<tr>
			<td class="key"><?php echo $row->getSid();?><span style="display:block;padding-top:3px;"><strong>IP Address:</strong><br/><?php echo $row->getIp();?></span></td>
			<td class="key">
				<strong style="float:right;" class="red"><?php echo $row->getHost();?></strong>
				<a href="<?php echo $url;?>" target="_blank"><?php echo $url;?></a>
				<span style="display:block;padding-top:3px;">
					<strong>RF:</strong> <?php echo $ref;?><br/>
					<strong>UA:</strong> <?php echo $row->getUserAgent();?>
				</span>
			</td>
			<td class="time">
				<?php echo $this->date($row->getModified());?><br/>
				<strong>Expired time:</strong><br/>
				<?php echo $this->date($row->getModified() + $row->getLifetime());?>
			</td>
			<td class="center"><?php
				if(in_array($row->getSid(), $this->checkedList)) {
					$checked = array('checked' => 'checked');
				} else {
					$checked = array();
				}
				echo $this->form()->checkbox('sid[]', $row->getSid(), array_merge(array('sid' => 'sid-' . $row->getSid()), $checked));
			?></td>
		<?php } ?>
		<?php if(count($this->list) <= 0) {?>
		<tr>
			<td colspan="4" class="nohover">
				<div class="msg">
					<div class="common error" style="border:0;background:#fff;">
						<i class="icon"></i>
						<h4>STOP</h4>
						<div class="msg-bd">
							No Session found. 
						</div>
					</div>
				</div>
			</td>
		</tr>
		<?php } ?>
	</table>
</div>
<div class="body">
	<div style="float:right;margin-bottom:5px;">
		<?php echo $this->render('include/deleteButton.phtml');?>
	</div>
	<?php echo $this->paginator($this->list)->render();?>
</div>
</form>
